package com.csair.action;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.XmlWebApplicationContext;

import com.csair.uplatform.dto.GroupMemberDTO;
import com.csair.uplatform.service.GroupMemberService;

@Namespace("/loginUser")
public class LoginUserAction {

	private static Logger log = LoggerFactory.getLogger(LoginUserAction.class);
	@Autowired
	private GroupMemberService groupMemberService;
	@Action(value="login", results={@Result(name="success", location="contentLogin.jsp")})
	public String init() {
		log.info("action begin.....");
		String username = ServletActionContext.getRequest().getParameter("username");
		String password = ServletActionContext.getRequest().getParameter("password");
		log.info("username: " + username);
		log.info("password: " + password);
		GroupMemberDTO dto = groupMemberService.getEmployee(1);
		log.info("vipNo:" + dto.getVipNo());
		return "success";
	}
	
	public void test() {
		ContextLoaderListener d;
		XmlWebApplicationContext c;
	}
}
